package com.tj.collection.service;

import com.fqgj.log.factory.LogFactory;
import com.fqgj.log.interfaces.Log;
import com.google.common.collect.Lists;
import com.tj.collection.enums.CollectionConclusionEnum;
import com.tj.collection.enums.CollectionOverdueTimeEnums;
import com.tj.collection.enums.CollectionStatusEnums;
import com.tj.collection.enums.DeductTypeEnum;
import com.tj.collection.service.dto.CollectionCommentVo;
import com.tj.collection.service.dto.CommonParam;
import com.tj.collection.service.param.CollectionCommentParam;
import com.tj.collection.service.param.CommonCollectionOrderParam;
import org.springframework.stereotype.Component;

import java.util.ArrayList;
import java.util.List;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: WatsonQiu
 * Date: 2017/7/21
 * Time: 下午3:52
 */
@Component
public class CollectionApplication {
    private static final Log LOGGER = LogFactory.getLog(CollectionApplication.class);

    /**
     * 获取催收状态
     *
     * @return
     */
    public List<CommonCollectionOrderParam> getCommonStatusParam() {
        List<CommonCollectionOrderParam> params = new ArrayList<>();
        List<CollectionStatusEnums> collectionStatusEnums = CollectionStatusEnums.getCollectionStatusEnums();
        for (CollectionStatusEnums enums : collectionStatusEnums) {
            CommonCollectionOrderParam param = new CommonCollectionOrderParam();
            param.setType(enums.getType() + "");
            param.setDesc(enums.getDesc());
            param.setShortDesc(enums.getShortDesc());
            params.add(param);
        }
        return params;
    }

    /**
     * 获取催收状态
     *
     * @return
     */
    public List<CommonCollectionOrderParam> getConclusionParam() {
        List<CommonCollectionOrderParam> params = new ArrayList<>();
        List<CollectionConclusionEnum> collectionStatusEnums = Lists.newArrayList(CollectionConclusionEnum.BE_WILLING, CollectionConclusionEnum.UNWILLING);
        for (CollectionConclusionEnum enums : collectionStatusEnums) {
            CommonCollectionOrderParam param = new CommonCollectionOrderParam();
            param.setType(enums.getType() + "");
            param.setDesc(enums.getDesc());
            param.setShortDesc(enums.getDesc());
            params.add(param);
        }
        return params;
    }

    /**
     * 获取预期天数参数
     *
     * @return
     */
    public List<CommonCollectionOrderParam> getCommonOverdueDaysParam() {
        List<CommonCollectionOrderParam> params = new ArrayList<>();
        for (CollectionOverdueTimeEnums enums : CollectionOverdueTimeEnums.values()) {
            CommonCollectionOrderParam param = new CommonCollectionOrderParam();
            param.setType(enums.getType() + "");
            param.setDesc(enums.getDesc());
            params.add(param);
        }
        return params;
    }

    /**
     * 备注列表
     *
     * @param collectionCommentParam
     * @return
     */
    public List<CollectionCommentVo> getCollectionCommentListByCondition(CollectionCommentParam collectionCommentParam) {
        return new ArrayList<>();
    }

    public List<CommonCollectionOrderParam> getDeductTypeList(String appClient) {
        List<CommonCollectionOrderParam> deductTypeList = new ArrayList<>();
        List<DeductTypeEnum> deductTypeEnumList = null;
        if ("web".equals(appClient)) {
            deductTypeEnumList = DeductTypeEnum.getWebDeductTypeEnumList();
        } else if ("android".equals(appClient)) {
            deductTypeEnumList = DeductTypeEnum.getAppDeductTypeEnumList();
        } else {
            deductTypeEnumList = new ArrayList<>();
        }
        for (DeductTypeEnum deductTypeEnum : deductTypeEnumList) {
            CommonCollectionOrderParam type = new CommonCollectionOrderParam();
            type.setType(deductTypeEnum.getValue());
            type.setDesc(deductTypeEnum.getName());
            type.setShortDesc(deductTypeEnum.getName());
            deductTypeList.add(type);
        }
        return deductTypeList;
    }

}
